home *** CD-ROM | disk | FTP | other *** search
- property UpButton, DownButton, scrollState, grabberClicked, overButton
-
- on catchEvent me, xEvent
- case xEvent of
- #top:
- if scrollState <> #top then
- set scrollState to #top
- updateButtons(me)
- end if
- #middle:
- if scrollState <> #middle then
- set scrollState to #middle
- updateButtons(me)
- end if
- #bottom:
- if scrollState <> #bottom then
- set scrollState to #bottom
- updateButtons(me)
- end if
- #grabberClicked:
- if not grabberClicked then
- set grabberClicked to 1
- updateButtons(me)
- end if
- #grabberReleased:
- if grabberClicked then
- set grabberClicked to 0
- updateButtons(me)
- end if
- #overUp, #overDown, #overNone:
- set overButton to xEvent
- updateButtons(me)
- end case
- end
-
- on turnON me
- updateButtons(me)
- end
-
- on turnOff me
- turnOff(UpButton)
- turnOff(DownButton)
- end
-
- on new me
- set grabberClicked to 0
- return me
- end
-
- on linkUp me, xUpButton, xDownButton
- set UpButton to xUpButton
- set DownButton to xDownButton
- turnOff(me)
- end
-
- on updateButtons me
- if grabberClicked then
- turnOff(UpButton)
- turnOff(DownButton)
- else
- case overButton of
- #overUp:
- turnOff(DownButton)
- if scrollState <> #top then
- turnON(UpButton)
- else
- turnOff(UpButton)
- end if
- #overDown:
- turnOff(UpButton)
- if scrollState <> #bottom then
- turnON(DownButton)
- else
- turnOff(DownButton)
- end if
- otherwise:
- normalButtons(me)
- end case
- end if
- end
-
- on normalButtons me
- case scrollState of
- #top:
- turnOff(UpButton)
- turnON(DownButton)
- #middle:
- turnON(UpButton)
- turnON(DownButton)
- #bottom:
- turnON(UpButton)
- turnOff(DownButton)
- end case
- end
-